package com.le.tester.leetcode;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * createTime：2022/5/31 10:29
 * description：反转字符串,第一个换到最后一个，最后一个换到第一个
 */
public class ReverseString {
    public void reverseString(char[] s) {

        int index = s.length;
        int j = index - 1;
        int k = index - 1;
        for (int i = 0; i < j; i++) {
            char temp = s[i];
            s[i] = s[j--];
            s[k] = temp;
            k--;

        }
        System.out.println(Arrays.toString(s));
    }

    public static void main(String[] args) {
        ArrayList<Object> objects = new ArrayList<>();
        objects.add(1);
        objects.add(2);
        objects.add(3);
        objects.add(4);
        objects.add(5);
        //System.out.println(objects.size());
        System.out.println(objects.toString());
        System.out.println(objects.get(objects.size()));
    }
}
